import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtGui import QIcon


class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)  # 初始化父类属性
        self.resize(400, 300)  # 设置窗口大小
        self.setWindowTitle("My First PyQt5 App")  # 设置窗口标题

        self.status = self.statusBar()  # 创建状态栏
        self.status.showMessage("Ready", 6000)  # 在状态栏显示信息


def main():
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon("./images/icon.png"))  # 设置应用图标

    w = MainWindow()
    w.show()
    sys.exit(app.exec_())


if __name__ == "__main__":
    main()
